package com.glueball.crm.module.client.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlRootElement;

import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.DBRef;
import org.springframework.data.mongodb.core.mapping.Document;

@XmlAccessorType(XmlAccessType.NONE)
@XmlRootElement(name = "person")
@Document(collection="persons")
public class Contact implements Serializable {

    private static final long serialVersionUID = 1L;
    @XmlAttribute
    @Id
    private String id;
    private String firstName = "";
    private String lastName = "";
    private String titulus = "";
    private String post = ""; 
    private boolean active = true;

    @DBRef
    private List<PhoneNumber> phones  = new ArrayList<PhoneNumber>();
    @DBRef
    private List<EmailAddress> emails = new ArrayList<EmailAddress>();

    public boolean isActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getTitulus() {
        return titulus;
    }

    public void setTitulus(String titulus) {
        this.titulus = titulus;
    }

    public List<PhoneNumber> getPhones() {
        if (this.phones == null)
            this.phones = new ArrayList<PhoneNumber>();
        return phones;
    }

    public void setPhones(List<PhoneNumber> phone) {
        this.phones = phone;
    }

    public List<EmailAddress> getEmails() {
        if (this.emails == null)
            this.emails = new ArrayList<EmailAddress>();
        return emails;
    }

    public void setEmails(List<EmailAddress> email) {
        this.emails = email;
    }

    public String getPost() {
        return post;
    }

    public void setPost(String post) {
        this.post = post;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}
